package com.leetcode;

import org.junit.Test;

import java.util.Arrays;

/**
 * Created by Z-hong on 2022/9/26.
 */

public class LeetCode面试1719 {
    public int[] missingTwo(int[] nums) {
        int [] arr=new int[2];
        int arr_count=0;
        int count=1;
        Arrays.sort(nums);
        for (int i = 0; i <nums.length; i++) {
            if (nums[i]==count){count++;continue;}
            arr[arr_count++]=count++;
            --i;
        }
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]==0){
                arr[i]=count++;
            }
        }
        return arr;
    }

    @Test
    public void test(){
        int[] arr={1,3};
        System.out.println(Arrays.toString(missingTwo(arr)));
    }
}
